package com.lanchetech.dao;

import com.lanchetech.bean.request.PageReq;
import com.lanchetech.bean.vo.BargainRecordVO;
import com.lanchetech.entity.BargainRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

@Mapper
public interface BargainRecordMapper {
    int deleteByPrimaryKey(Long id);

    int insert(BargainRecord record);

    int insertSelective(BargainRecord record);

    BargainRecord selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(BargainRecord record);

    int updateByPrimaryKey(BargainRecord record);

    Long sumByUserIdAndActivityId(@Param("userId") Long userId, @Param("activityId") Long activityId);

    List<BargainRecordVO> findAllPage(PageReq req);
    BargainRecord findOneByUserIdAndSkuIdAndStatus(@Param("userId") Long userId, @Param("skuId") Long skuId, @Param("status") Byte status);

    BargainRecord findOneByUserIdAndActivityIdAndSkuIdAndStatus(@Param("userId")Long userId,@Param("activityId")Long activityId,@Param("skuId")Long skuId,@Param("status")Byte status);

    int updateStatusAndUpdatedAtById(@Param("updatedStatus") Byte updatedStatus, @Param("updatedUpdatedAt") Date updatedUpdatedAt, @Param("id") Long id);
}